
#include <cassert>
#include <iostream>
#include <memory>
using namespace std;

inline void pt(int &a, int v) { a = v; }

class father {
  // int a;
public:
  father() { std::cout << "father construct" << std::endl; };
  virtual void setData(int v){};
  virtual void pnt() { cout << "father" << endl; };
  virtual void pnt2(const string info = "info") {
    //   virtual void pnt2(const string info) {
    std::cout << "father " << info << std::endl;
  }
  virtual ~father(){};
};

class child : public father {
  int a;

public:
  child() { std::cout << "child construct" << std::endl; };
  void setData(int v) override { pt(a, v); }
  void pnt() override { cout << a << endl; }
  void ppt() { cout << "\nok or not\n" << endl; }
  void pnt2(const string info = "info") {
    std::cout << "child " << info << std::endl;
  }
  ~child(){};
};

int main() {
  father *p;
  p = new child;
  p->setData(2);
  p->pnt();
  // p->ppt(); wrong
  father a;
  a.pnt();

  std::cout << "===================================" << std::endl;
  unique_ptr<father> obj;
  obj = make_unique<child>();
  obj->pnt2();
  return 0;
}